import http from '@/utils/request'
// 登录
export const reqLogin = (data) => {
  return http({
    method: 'POST',
    url: '/api/login',
    data: data
  })
}

// 注册
export const reqReg = (data) => {
  return http({
    method: 'POST',
    url: '/api/reg',
    data: data
  })
}

// 获取用户信息
export const reqGetUserInfo = () => {
  return http({
    method: 'GET',
    url: '/my/userinfo'
    // headers: { Authorization: localStorage.getItem('token') }
  })
}

// 更新用户的基本信息
export const reqUpdateUserInfo = (data) => {
  return http({
    method: 'PUT',
    url: '/my/userinfo',
    data
  })
}

// 更换头像
export const reqUpdateAvatar = (avatar) => {
  return http({
    method: 'PATCH',
    url: '/my/update/avatar',
    data: {
      avatar
    }
  })
}

// 重置密码
export const reqResetPwd = (data) => {
  return http({
    method: 'PATCH',
    url: '/my/updatepwd',
    data
  })
}
